import { ApiProperty } from '@nestjs/swagger';
import * as dayjs from 'dayjs';
import { Column, Entity, PrimaryGeneratedColumn } from 'typeorm';

@Entity()
export class Live {
  @ApiProperty({ description: 'id' })
  @PrimaryGeneratedColumn('uuid')
  id: string;

  @ApiProperty({ description: '直播间标题' })
  @Column({ length: 500 })
  title: string;

  @ApiProperty({ description: '直播间说明' })
  @Column({ length: 500 })
  explain: string;

  @ApiProperty({ description: '可容纳人数' })
  @Column('int', { default: 1 })
  peopleCount: number;

  @ApiProperty({ description: '当前人数' })
  @Column('int', { default: 1 })
  peopleLiveCount: number;

  // @ApiProperty({ description: 'rtc id' })
  // @Column({ length: 500 })
  // rtc: string;

  @ApiProperty({ description: '是否可见' })
  @Column('boolean', { default: false })
  isVisiable: boolean;

  @ApiProperty({ description: '是否可加入' })
  @Column('boolean', { default: false })
  isEnter: boolean;

  @ApiProperty({ description: '是否有房间密码' })
  @Column('boolean', { default: false })
  hasPassed: boolean;

  @ApiProperty({ description: '房间密码' })
  @Column({ length: 500, default: 'a123456' })
  password: string | undefined;

  // @ManyToOne(() => NewUser, (user) => user.id)
  // @JoinColumn()
  // user: NewUser;

  @ApiProperty({ description: '创建者' })
  @Column({ length: 500, default: '' })
  userId: string;

  @ApiProperty({ description: '创建时间' })
  @Column('datetime', { default: dayjs().format() })
  createAt: string;

  @ApiProperty({ description: '更新时间' })
  @Column('datetime', { default: dayjs().format() })
  updateAt: string | undefined;

  @ApiProperty({ description: '删除时间' })
  @Column('datetime', { default: dayjs().format() })
  deleteAt: string | undefined;

  //   TODO
  // 电影表
}
